﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using AutoDownload.Settings;

namespace AutoDownload.Config.Editor
{
    public partial class DailyAirEditor : Form
    {
        private AutoDownload.Settings.Config m_ConfigFile;

        public AutoDownload.Settings.Config ConfigFile
        {
            get { return m_ConfigFile; }
            set { m_ConfigFile = value; }
        }
        public DailyAirEditor(AutoDownload.Settings.Config configFile)
        {
            InitializeComponent();

            ConfigFile = configFile;
            tbSubject.Text = ConfigFile.OverviewSubject.Replace("\n", Environment.NewLine);
            tbHeader.Text = ConfigFile.OverviewHeader.Replace("\n", Environment.NewLine);
            tbIterator.Text = ConfigFile.OverviewIterator.Replace("\n", Environment.NewLine);
            tbFooter.Text = ConfigFile.OverviewFooter.Replace("\n", Environment.NewLine);
            tbKey.Text = ConfigFile.PersonalAPIKey;

        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            ConfigFile.OverviewSubject = tbSubject.Text.Replace(Environment.NewLine, "\n");
            ConfigFile.OverviewHeader = tbHeader.Text.Replace(Environment.NewLine, "\n");
            ConfigFile.OverviewIterator = tbIterator.Text.Replace(Environment.NewLine, "\n");
            ConfigFile.OverviewFooter = tbFooter.Text.Replace(Environment.NewLine, "\n");
            ConfigFile.PersonalAPIKey = tbKey.Text;

            this.Close();
        }
    }
}
